package com.qqtop10.manager.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.ui.ModelMap;

import com.qqtop10.manager.dao.RebateMapper;
import com.qqtop10.manager.model.KeyEntity;
import com.qqtop10.manager.model.PagingArgs;
import com.qqtop10.manager.model.Rebate;
import com.qqtop10.manager.service.RebateService;

@Service("RebateService")
public class RebateServiceImpl extends BaseService implements RebateService {

	@Autowired
	private RebateMapper RebateMapper;

	@Override
	public List<Rebate> all(Rebate input, PagingArgs pagingArgs) {
		return RebateMapper.all(asMap(input, pagingArgs));
	}

	@Override
	public int count(Rebate input) {
		try {
			return RebateMapper.count(input);
		} catch (Exception e) {
			return 0;
		}
	}

	@Override
	public int delete(int id) {
		return RebateMapper.delete(id);
	}

	@Override
	public int update(Rebate Rebate) {
		return RebateMapper.update(Rebate);
	}

	public int approve(List<String> uuid) {
		return RebateMapper.approve(uuid);
	}

	public int addCoupon(ModelMap input) {
		return RebateMapper.addCoupon(input);
	}
	
	public Rebate selectById(KeyEntity input) {
		return RebateMapper.selectById(input);
	}
}
